/*
 * 文件名               :  NetwordBridge.java
 * 用途                    :  网络桥,用于监听新的桥连接请求
 * 最后修改日期:  $LastChangedDate: 2009-09-07 13:35:47 +0000 (Mon, 07 Sep 2009) $
 * 最后修改者     :  $LastChangedBy: wendal1985@gmail.com $
 * 创建者               :  Wendal Chen <wendal1985@gmail.com>
 */
package com.wendal.java.preproxy.bridge;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

import javax.net.ServerSocketFactory;


public class NetwordBridge extends Thread {

	private boolean flag = true;

	@Override
	public void run() {
		ServerSocket serverSocket = null;
		try {
			serverSocket = ServerSocketFactory.getDefault().createServerSocket(
					8600);
		} catch (IOException e) {
			e.printStackTrace();
			return;
		}
		while (flag) {
			Socket socket;
			try {
				socket = serverSocket.accept();
			} catch (IOException e1) {
				e1.printStackTrace();
				break;
			}
			System.out.println("有一个连接: " + socket);
			new UserLoginThread(socket).start();
		}

	}
}
